<template>
  <div>

    <!--    <el-skeleton :rows="6" animated />-->
    <el-table
        :data="tableData"
        border
        stripe
        style="width: 100%">
      <el-table-column
          fixed
          prop="applyid"
          label="申请ID"
          width="150">
      </el-table-column>
      <el-table-column
          prop="uid"
          label="申请人"
          width="120">
      </el-table-column>
      <el-table-column
          prop="applyCreate"
          label="申请时间"
          width="120">
      </el-table-column>
      <el-table-column
          prop="applyType"
          label="申请状态"
          width="120">
      </el-table-column>
      <el-table-column
          prop="applyContent"
          label="申请详情"
          width="200">
      </el-table-column>
      <el-table-column
          prop="applyClass"
          label="申请标签"
          width="120">

      </el-table-column>
      <el-table-column
          fixed="right"
          label="操作"
          width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row.applyid)" type="text" size="small">查看</el-button>
          <el-button type="text" size="small">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>


    <el-drawer
        title="查看申请"
        :visible.sync="drawer"
        direction="ltr"
        :before-close="handleClose">
        <span style="font-size: 12px;color: #909399;">
        正文:
      </span>
      <div style="border: solid 1px #EBEEF5;
        font-size: 14px;
         border-radius: 4px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
         color: #606266;text-align: left;">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年后拉开见到过爱的色放就拉开圣诞节啊撒旦解放立刻从下安德森出来放假啦看到是否啊圣诞节分厘卡文件二分类
        {{ getOneInfo.applyContent }}
      </div>

      <div style="margin-left: 60%;
      position: absolute;
      bottom: 22%;
      float: left;color: #606266;font-size: 13px ">
          <span style="float: left;#303133;">
          用户:{{ getOneInfo.applyid }}
        </span><br>
        <span style="float: left;#303133;">
          时间:{{ getOneInfo.applyCreate }}
        </span><br>
        <span style="float: left;#303133;">
          类型:{{ getOneInfo.applyClass }}
        </span><br>
        <span style="float: left;#303133;">
            申请状态:{{ getOneInfo.applyType }}
          </span><br>
      </div>
      <div style="position:absolute;
     bottom:10%; left: 25%; text-align:center; ">
        <el-button type="success" @click="applyOkey()" plain>通过</el-button>
        <el-button type="warning" plain>不通过</el-button>

      </div>


    </el-drawer>

  </div>
</template>

<script>
export default {
  name: "ApplyControl",
  methods: {
    handleClick(row) {
      console.log(row);
      this.drawer = true
      const url = "/apply-all/getById?applyid="
      console.log(url + row)
      this.$axios.post(url + row)
          .then((res) => {
            console.log(res);
            // this.tableData = this.tableData.concat(res.data.records)
            this.getOneInfo = res.data;
          });

    },
    handleClose(done) {
      this.$confirm('审核了？')
          .then(_ => {
            console.log(_)
            done();
          })
          .catch(_ => {
            console.log(_)
          });
      done()
    },
    applyOkey() {
      const url = "/apply-all/getById?applyid="
      console.log(url)
      this.$axios.post(url)
          .then((res) => {
            console.log(res);
            // this.tableData = this.tableData.concat(res.data.records)
            this.getOneInfo = res.data;
          });
    }
  },
  created: function () {
    // const _this = this;
    const url = "/apply-all/page/1"
    this.$axios.get(url)
        .then((res) => {
          // res.data.records[].applyCreate
          console.log(this.tableData.concat(res.data.records));
          this.tableData = this.tableData.concat(res.data.records)
        });
  },

  data() {
    return {
      tableData: [],
      drawer: false,
      direction: 'rtl',
      getOneInfo: {}
    }
  }

}
</script>

<style>

</style>